{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 5, 6]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dice= [1,2,3,4,5,6]\n",
    "dice"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import random\n",
    "\n",
    "def sensor_value(): \n",
    "    noise = sum([ random.choice(dice) for i in range(10)]) #10回サイコロを振って値を足す\n",
    "    return 200 + noise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       229\n",
       "1       235\n",
       "2       238\n",
       "3       245\n",
       "4       231\n",
       "5       231\n",
       "6       231\n",
       "7       238\n",
       "8       220\n",
       "9       239\n",
       "10      224\n",
       "11      231\n",
       "12      231\n",
       "13      241\n",
       "14      229\n",
       "15      239\n",
       "16      233\n",
       "17      234\n",
       "18      226\n",
       "19      227\n",
       "20      236\n",
       "21      239\n",
       "22      234\n",
       "23      245\n",
       "24      236\n",
       "25      237\n",
       "26      230\n",
       "27      237\n",
       "28      238\n",
       "29      237\n",
       "       ... \n",
       "9970    239\n",
       "9971    240\n",
       "9972    234\n",
       "9973    237\n",
       "9974    231\n",
       "9975    239\n",
       "9976    239\n",
       "9977    247\n",
       "9978    228\n",
       "9979    228\n",
       "9980    230\n",
       "9981    232\n",
       "9982    225\n",
       "9983    239\n",
       "9984    231\n",
       "9985    243\n",
       "9986    232\n",
       "9987    242\n",
       "9988    239\n",
       "9989    240\n",
       "9990    235\n",
       "9991    234\n",
       "9992    236\n",
       "9993    234\n",
       "9994    239\n",
       "9995    236\n",
       "9996    231\n",
       "9997    228\n",
       "9998    234\n",
       "9999    240\n",
       "Name: sensor, Length: 10000, dtype: int64"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame([sensor_value() for i in range(10000)],columns=[\"sensor\"])\n",
    "df[\"sensor\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEICAYAAABRSj9aAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAGZZJREFUeJzt3X+QHOV95/H3x/yywtpafmUjSzqL\nMzIxYcsY7QGOfXe76JyAcCyuggk+JZY4Xe1dHTg4KBVwqIpJ3blKVE4mkLjgNoUrIoW95rA5FAUS\nUzJ7KSonYgmDFpA5FiyM9hTpIJLwgkws870/+lEYTXZ3erQ9O7OPPq+qqel++unZz/TufKf3mZ5u\nRQRmZpavd7U7gJmZtZYLvZlZ5lzozcwy50JvZpY5F3ozs8y50JuZZc6F3swscy70ZmaZc6E3myWS\nTmx3Bjs+udBbliTdJGlc0o8kPS9puaR3SbpZ0ouSXpN0v6TTU/8lkkLSakk/lPSqpFtqHu8iSdsk\nvS5pr6Qv1yz7lKRnJR2QNCLpQzXLdqUsO4A3XOytHVzoLTuSzgWuB/5FRLwH+GVgF/A54ErgXwPv\nA/YDX6lb/ePAucBy4PdqivYdwB0R8V7gA8D96Wd9EPg68HngLOBh4M8lnVzzmJ8BrgC6I+JwpU/W\nrAQXesvRT4FTgPMknRQRuyLiReA/AbdExO6IeAu4Fbiqbi/79yPiUEQ8DTwNfDi1/wQ4R9KZETER\nEVtT+68BfxERj0bET4D/BswDfrHmMe+MiFci4lCrnrDZdFzoLTsRMUaxh30rsE/SsKT3Ae8HHkxD\nLAeAnRRvCj01q/9dzfSbQFeaXgt8EPi+pO9K+mRqfx/wcs3Pfht4BVh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q7QH+WUR8BLgR+Jqk985GRpg6p6RbgMPAfbOVZSpNZGzbtpwsY0Tc\nEhGLU77rp1t/NjSR8UmK8498GPgj4H+2IyPF7/Z3OfoNqO2ayNgR2zH9ru8CPgBcQPE62TBbWarS\ncYVe0kkUG/m+iPjWdH3Tv0yvpentFGNkH2x9yqlzSloDfBJYFWkgjzadFqKZjO3aliV+3/cBv5qm\nO2o71vjHjBHxekRMpOmHgZOOfMA4yxk/QDFu/LSkXRTb6klJP0fnbMcpM3bQdiQi9kbETyPibeBP\neGd4Zu6c7qXdHxLU3ig+HLoX+MMplo9w9IexZ5E+/AD+OcVGPr1dOYHLKE7HfFZd+y9w9Ic2L9H6\nD2ObzTjr23KajEtrpj8HPJCmr+DoDxH/to2/66ky/hzvfBHxIuCHR+ZnO2Ndn12880Fnx2zHaTJ2\nzHYEFtRM/xbFuHxbXtfH/NzaHaBug36c4gOZHcBT6bYC+LcU419vAXuBv0r9fxV4NvV7EviVNucc\noxizO9J2d806t1DsJT8PXN5pGduxLafJ+E3gmdT+5xQffh55IX4lbcdRat70Oyjj9Wk7Pk3xYfcv\ntitjXZ/aItox23GajB2zHYE/S9tpB8V5u2oL/6y+ro/15lMgmJllruPG6M3MrFou9GZmmXOhNzPL\nnAu9mVnmXOjNzDLnQm9mljkXejOzzP1/c1D+5ad8pt0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1099fab00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "df.hist(bins = max(df[\"sensor\"]) - min(df[\"sensor\"]),align='left')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# サイコロの平均と分散（計算でも求まりますがここは乱数から）\n",
    "df[\"dice\"] = [ random.choice(dice) for i in range(10000) ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "平均: 3.4907\n",
      "分散: 2.9246059706\n"
     ]
    }
   ],
   "source": [
    "mean_dice = df[\"dice\"].mean()\n",
    "var_dice = df[\"dice\"].var()\n",
    "print(\"平均: \" + str(mean_dice))\n",
    "print(\"分散: \" + str(var_dice))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "平均: 235.0267\n",
      "分散: 28.4162287329\n"
     ]
    }
   ],
   "source": [
    "# センサ値の平均と分散\n",
    "mean_sensor = df[\"sensor\"].mean()\n",
    "var_sensor = df[\"sensor\"].var()\n",
    "print(\"平均: \" + str(mean_sensor))\n",
    "print(\"分散: \" + str(var_sensor))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200.11970000000002"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# センサ値の平均からサイコロを10回振ったときの期待値を引くと、最初に足した200になる\n",
    "mean_sensor - mean_dice*10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.82983097309731235"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# センサ値の分散は、サイコロを10回振ったので10倍に近い値になる\n",
    "var_sensor - var_dice*10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
